package com.lh.elevator;

import lombok.Data;

@Data
public class User {

    private Elevator elevator;

    /**
     * 1 上 2 下
     */
    private Integer status;

    private Integer currentHeight;

    /**
     * 需要去的楼层
     */
    private Integer needHeight;

    public void setNeedHeight(Integer needHeight) {
        this.needHeight = needHeight;
            //当电梯与用户不在同一层
            if (currentHeight < elevator.getHeight()) {
                elevator.getDownQueue().add(currentHeight);
            }
            if (currentHeight > elevator.getHeight()) {
                elevator.getUpQueue().add(currentHeight);
            }
            if (status == 1){
                elevator.getUpQueue().add(needHeight);
            }
            if (status == 2){
                elevator.getDownQueue().add(needHeight);
            }


    }
}
